<%--
  Created by IntelliJ IDEA.
  User: 1
  Date: 2022/10/18
  Time: 12:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>Register</title>
    <style type="text/css">



        body{

            background-image: url("images/aa.webp");
            background-size: cover;
            color: white;
        }
    </style>
</head>
<body>
<h1 align="center"> 宿舍注册页面 </h1>
<form  action="studentinsert"  method="post">

    <table  height="80%" width="25%">
        <tr>
            <td>用户名：&nbsp;</td>
            <td><input type="text" name="username" id="name" size="25" placeholder="用户名长度必须在3到10位之间！" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>密&nbsp;&nbsp;&nbsp;码：&nbsp;</td>
            <td><input type="password" name="password" id="pw" size="25"placeholder="密码长度大于4" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>学&nbsp;&nbsp;&nbsp;号：&nbsp;</td>
            <td><input type="text" name="number" id="number" size="25" placeholder="学号必须等于12位！"style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>学生名字：</td>
            <td><input type="text" name="stunam" id="stunam" size="25" style="margin-left: 12px;"></td>>
        </tr>
        <tr>
            <td>院&nbsp;&nbsp;&nbsp;系：&nbsp;</td>
            <td><input type="text" name="college" id="college" size="25" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>专&nbsp;&nbsp;&nbsp;业：&nbsp;</td>
            <td><input type="text" name="mayor" id="mayor" size="25" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>班&nbsp;&nbsp;&nbsp;级：&nbsp;</td>
            <td><input type="text" name="class" id="class" size="25" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>性&nbsp;&nbsp;&nbsp;别：&nbsp;</td>
            <td><input type="radio" name="sex" value="男">男&nbsp;&nbsp;
            <input type="radio" name="sex" value="女">女&nbsp;&nbsp;</td>
        </tr>
        <tr>
            <td>宿&nbsp;&nbsp;&nbsp;舍：&nbsp;</td>
            <td><input type="text" name="home" id="home" size="25" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>入住时间：</td>
            <td><input type="text" name="time" id="year" size="25" style="margin-left: 12px;"></td>
        </tr>
        <tr>
            <td>手&nbsp;&nbsp;&nbsp;机：&nbsp;</td>
            <td><input type="text" name="phone" id="phone" size="25" placeholder="手机号必须为11位！" style="margin-left: 12px;"></td>
        </tr>

        <tr>
            <td><input type="reset" value="清空"></td>
            <td><input type="submit" value="提交"></td>
             <input type="button" value="返回" onClick="javascript:history.back (-1)">
        </tr>
    </table>
</form>
<script>
    function check()
    {
        //用户名验证
        var n=document.getElementById("name");
        n = n.value;
        if(n.length<3||n.length>10)
        {
            alert("用户名长度必须在3到10位之间！");
            return false;
        }

        //密码验证
        var m=document.getElementById("pw");
        m=m.value;
        if(m.length < 5 )
        {
            alert("密码长度大于4");
            return false;
        }
        //学号验证
        var p = document.getElementById("number");
        p=p.value;
        if(p.length!=12)
        {
            alert("学号必须等于12位！");
            return false;
        }


        //手机验证
        var p = document.getElementById("phone");
        p=p.value;
        if(p.length!=11)
        {
            alert("手机号必须为11位！");
            return false;
        }

    }

</script>
</body>
</html>
